import request from '@/utils/request'

// 获取借阅记录列表
export const getBorrowList = (params) => {
  return request({
    url: '/borrow-records',
    method: 'get',
    params
  })
}

// 获取我的借阅记录
export const getMyBorrows = (params) => {
  return request({
    url: '/borrow-records/my',
    method: 'get',
    params
  })
}

// 借阅图书
export const borrowBook = (data) => {
  return request({
    url: '/borrow-records/borrow',
    method: 'post',
    data
  })
}

// 归还图书
export const returnBook = (id) => {
  return request({
    url: `/borrow-records/${id}/return`,
    method: 'post'
  })
}

// 续借图书
export const renewBook = (id) => {
  return request({
    url: `/borrow-records/${id}/renew`,
    method: 'post'
  })
}

// 获取借阅统计
export const getBorrowStats = () => {
  return request({
    url: '/borrow-records/statistics',
    method: 'get'
  })
}

// 获取逾期记录
export const getOverdueRecords = (params) => {
  return request({
    url: '/borrow-records/overdue',
    method: 'get',
    params
  })
}